import request from '@/utils/request'
import type { LoginForm, RegisterForm, User, ApiResponse } from '@/types'

export const authApi = {
  // 登录
  login(data: LoginForm): Promise<ApiResponse<{ user: User; token: string }>> {
    return request.post('/auth/login', data)
  },
  
  // 注册
  register(data: RegisterForm): Promise<ApiResponse<{ user: User; token: string }>> {
    return request.post('/auth/register', data)
  },
  
  // 获取当前用户信息
  getUserInfo(): Promise<ApiResponse<User>> {
    return request.get('/auth/me')
  }
}

